﻿using System.Web.Mvc;
using AllIsWell.Tests.TestData;
using NUnit.Framework;

namespace AllIsWell.Web.Tests.Controllers.DestinyControllerTests
{
    [TestFixture]
    class Index : DestinyControllerTest
    {
        [Test]
        public void ShouldRenderIndexPartialView()
        {
            var indexPartialView = DestinyController.Index();

            Assert.IsInstanceOf<PartialViewResult>(indexPartialView);
            Assert.AreEqual("_Index", indexPartialView.ViewName);
        }

        [Test]
        public void ShouldPassTheListOfDestiniesToView()
        {
            var destinies = new[] { DestinySeed.GetDestiny(1), DestinySeed.GetDestiny(2) };
            DestinyServiceMock.Setup(service => service.Destinies).Returns(destinies);

            var indexPartialView = DestinyController.Index();

            Assert.AreEqual(destinies, indexPartialView.Model);
        }
    }
}
